package org.gc.service.security;

import java.util.List;

import org.gc.common.entity.security.User;
import org.gc.common.vo.security.UserVO;
import org.gc.exception.UserExistsException;
import org.gc.service.base.BaseService;
import org.springframework.security.userdetails.UsernameNotFoundException;


public interface UserService extends BaseService<User, UserVO, Long> {
    /**
     * Finds a user by their username.
     * @param username the user's username used to login
     * @return User a populated user object
     * @throws org.springframework.security.userdetails.UsernameNotFoundException
     *         exception thrown when user not found
     */
    UserVO getUserByUsername(String username) throws UsernameNotFoundException;
    
    public UserVO register(UserVO userVO) throws UserExistsException;
    
    public boolean updatePassword(UserVO userVO, String oldPassword, String newPassword);
    
    public boolean resetPassword(String username, String email);
    
    /**
     * 获取全部后台用户
     * @return
     */
    public List<UserVO> getAllAdminUser();
    
    /**
     * 获取全部前台用户
     * @return
     */
    public List<UserVO> getAllNonAdminUser();
    
    /**
     * 重置用户密码
     * @param userid 用户ID
     * @return 返回新密码
     */
    public String xpassword(Long userid);
}
